package data;

import java.util.Date;
import java.util.ArrayList;
import java.util.List;

import com.EntityName;
import com.Util;
import com.google.appengine.api.datastore.Entity;

public class General extends AbstractData {
	private long id = -1;
	private long hotelId;
	private LanguageMaster defaultLanguage;
	private String defaultLanguageString;
	private List<LanguageMaster> usingLanguage;
	private String usingLanguageString;
	private List<CurrencyMaster> usingCurrency;
	private String usingCurrencyString;
	private CurrencyMaster defaultCurrency;
	private String defaultCurrencyString;
	private Date financialYearFrom;
	private Date financialYearTo;
	private double currencyConversionMargin;
	private short currencyDecimalPlaces;
	private boolean invoicesExclusiveTax;
	private boolean taxBreakUp;
	private boolean accountFolioOpeningDate;
	private DateTimeFormatMaster dateFormat;
	private String dateFormatString;
	private boolean timeFormatShow24Hours;
	private Date checkInTime;
	private Date checkOutTime;
	private Date nightAuditTime;
	private boolean auditUseCalendarDate;
	private CleaningStatus onNightAuditRollOverMarkOccupied;
	private String onNightAuditRollOverMarkOccupiedString;
	private CleaningStatus onNightAuditRollOverMarkVacantRoom;
	private String onNightAuditRollOverMarkVacantRoomString;
	private CleaningStatus markCheckedOutRoom;
	private String markCheckedOutRoomString;
	private boolean incloudetax;
	private double GMT;
	private String timeZone;
	
	private boolean currencyconvert;
	private long assumechild;
	private double agentcommission;
	private double coporatediscount;
	private double feeforcancel;
	private String ensuretype;
	private String ensureamount;
	private boolean ispercentofbooking;
	private boolean isasperbookingpolicy;
	private long earlycheckintimeamount;
	private long earlycheckouttimeamount;
	private long latecheckouttimeamount;
	private boolean earlycheckintimeunit;
	private boolean earlycheckouttimeunit;
	private boolean latecheckouttimeunit;
	private double earlycheckinchargeamount;
	private double earlycheckoutchargeamount;
	private double latecheckoutchargeamount;
	private long earlycheckinchargeunit;
	private long earlycheckoutchargeunit;
	private long latecheckoutchargeunit;
	
	private double noshow_charge;
	private boolean noshow_timeunit;
	private boolean noshow_isExpectedArrival;
	
	private long minuteForWarning;
	private long minuteForCritical;
	
	private Date lastNightAudit;
	private boolean inprogress;
	
	public General() {}
	
	public General(long id) {
		this.id = id;
	}

	public long getHotelId() {
		return hotelId;
	}
	public void setHotelId(long hotelId) {
		this.hotelId = hotelId;
	}
	@Override
	public long getId() {
		return id;
	}
	public LanguageMaster getDefaultLanguage() {
		if (defaultLanguage == null && !(defaultLanguageString == null || defaultLanguageString.isEmpty())) {
			LanguageMaster lang = new LanguageMaster(Long.parseLong(defaultLanguageString));
			lang.LoadData();
			defaultLanguage = lang;
		}
		return defaultLanguage;
	}
	public void setDefaultLanguage(LanguageMaster defaultLanguage) {
		this.defaultLanguageString = String.format("%d", defaultLanguage.getId());
		this.defaultLanguage = defaultLanguage;
	}
	
	
	public List<LanguageMaster> getUsingLanguage() {
		if ((usingLanguage == null || usingLanguage.size() == 0) && !(usingLanguageString == null || usingLanguageString.isEmpty())) {
			String[] idOfList = SplitList(usingLanguageString);
			List<LanguageMaster> list = new ArrayList<LanguageMaster>();
			for (String id : idOfList) {
				LanguageMaster c = new LanguageMaster(Long.parseLong(id));
				list.add(c);
			}
			
			for(LanguageMaster c : list)
				c.LoadData();
			
			usingLanguage = list;
		}
		return usingLanguage;
	}

	public void setUsingLanguage(List<LanguageMaster> usingLanguage) {
		this.usingLanguageString = CombineList(usingLanguage);
		this.usingLanguage = usingLanguage;
	}

	public String getUsingLanguageString() {
		return usingLanguageString;
	}

	public void setUsingLanguageString(String usingLanguageString) {
		this.usingLanguageString = usingLanguageString;
	}

	public List<CurrencyMaster> getUsingCurrency() {
		if ((usingCurrency == null || usingCurrency.size() == 0) && !(usingCurrencyString == null || usingCurrencyString.isEmpty())) {
			String[] idOfList = SplitList(usingCurrencyString);
			List<CurrencyMaster> list = new ArrayList<CurrencyMaster>();
			for (String id : idOfList) {
				CurrencyMaster c = new CurrencyMaster(Long.parseLong(id));
				list.add(c);
			}
			
			for(CurrencyMaster c : list)
				c.LoadData();
			
			usingCurrency = list;
		}
		return usingCurrency;
	}
	public void setUsingCurrency(List<CurrencyMaster> usingCurrency) {
		this.usingCurrencyString = CombineList(usingCurrency);
		this.usingCurrency = usingCurrency;
	}
	
	public CurrencyMaster getDefaultCurrency() {
		if (defaultCurrency == null && !(defaultCurrencyString == null || defaultCurrencyString.isEmpty())) {
			CurrencyMaster c = new CurrencyMaster(Long.parseLong(defaultCurrencyString));	
			c.LoadData();
			defaultCurrency = c;
		}
		return defaultCurrency;
	}
	public void setDefaultCurrency(CurrencyMaster defaultCurrency) {
		this.defaultCurrencyString = String.format("%d", defaultCurrency.getId());
		this.defaultCurrency = defaultCurrency;
	}
	public Date getFinancialYearFrom() {
		return financialYearFrom;
	}
	public void setFinancialYearFrom(Date financialYearFrom) {
		this.financialYearFrom = financialYearFrom;
	}
	public Date getFinancialYearTo() {
		return financialYearTo;
	}
	public void setFinancialYearTo(Date financialYearTo) {
		this.financialYearTo = financialYearTo;
	}
	public double getCurrencyConversionMargin() {
		return currencyConversionMargin;
	}
	public void setCurrencyConversionMargin(double currencyConversionMargin) {
		this.currencyConversionMargin = currencyConversionMargin;
	}
	public short getCurrencyDecimalPlaces() {
		return currencyDecimalPlaces;
	}
	public void setCurrencyDecimalPlaces(short currencyDecimalPlaces) {
		this.currencyDecimalPlaces = currencyDecimalPlaces;
	}
	public boolean isInvoicesExclusiveTax() {
		return invoicesExclusiveTax;
	}
	public void setInvoicesExclusiveTax(boolean invoicesExclusiveTax) {
		this.invoicesExclusiveTax = invoicesExclusiveTax;
	}
	public boolean isTaxBreakUp() {
		return taxBreakUp;
	}
	public void setTaxBreakUp(boolean taxBreakUp) {
		this.taxBreakUp = taxBreakUp;
	}
	public boolean isAccountFolioOpeningDate() {
		return accountFolioOpeningDate;
	}
	public void setAccountFolioOpeningDate(boolean accountFolioOpeningDate) {
		this.accountFolioOpeningDate = accountFolioOpeningDate;
	}
	public DateTimeFormatMaster getDateFormat() {
		if (dateFormat == null && !(dateFormatString == null || dateFormatString.isEmpty())) {
			DateTimeFormatMaster d = new DateTimeFormatMaster(Long.parseLong(dateFormatString));	
			d.LoadData();
			dateFormat = d;
		}
		return dateFormat;
	}
	public void setDateFormat(DateTimeFormatMaster dateFormat) {
		this.dateFormatString = String.format("%d", dateFormat.getId());
		this.dateFormat = dateFormat;
	}
	public boolean getTimeFormat() {
		return timeFormatShow24Hours;
	}
	public void setTimeFormat(boolean timeFormatShow24Hours) {
		this.timeFormatShow24Hours = timeFormatShow24Hours;
	}
	public Date getCheckInTime() {
		return checkInTime;
	}
	public void setCheckInTime(Date date) {
		this.checkInTime = date;
	}
	public Date getCheckOutTime() {
		return checkOutTime;
	}
	public void setCheckOutTime(Date checkOutTime) {
		this.checkOutTime = checkOutTime;
	}
	public Date getNightAuditTime() {
		return nightAuditTime;
	}
	public void setNightAuditTime(Date nightAuditTime) {
		this.nightAuditTime = nightAuditTime;
	}
	public boolean isAuditUseCalendarDate() {
		return auditUseCalendarDate;
	}
	public void setAuditUseCalendarDate(boolean auditUseCalendarDate) {
		this.auditUseCalendarDate = auditUseCalendarDate;
	}
	public CleaningStatus getOnNightAuditRollOverMarkOccupied() {
		if (onNightAuditRollOverMarkOccupied == null && !(onNightAuditRollOverMarkOccupiedString == null || onNightAuditRollOverMarkOccupiedString.isEmpty())) {
			CleaningStatus c = new CleaningStatus(Long.parseLong(onNightAuditRollOverMarkOccupiedString));
			c.LoadData();
			onNightAuditRollOverMarkOccupied = c;
		}
		return onNightAuditRollOverMarkOccupied;
	}
	public void setOnNightAuditRollOverMarkOccupied(CleaningStatus onNightAuditRollOverMarkOccupied) {
		this.onNightAuditRollOverMarkOccupiedString = String.format("%d", onNightAuditRollOverMarkOccupied.getId());
		this.onNightAuditRollOverMarkOccupied = onNightAuditRollOverMarkOccupied;
	}
	public CleaningStatus getOnNightAuditRollOverMarkVacantRoom() {
		if (onNightAuditRollOverMarkVacantRoom == null && !(onNightAuditRollOverMarkVacantRoomString == null || onNightAuditRollOverMarkVacantRoomString.isEmpty())) {
			CleaningStatus c = new CleaningStatus(Long.parseLong(onNightAuditRollOverMarkVacantRoomString));
			c.LoadData();
			onNightAuditRollOverMarkVacantRoom = c;
		}
		return onNightAuditRollOverMarkVacantRoom;
	}
	public void setOnNightAuditRollOverMarkVacantRoom(CleaningStatus onNightAuditRollOverMarkVacantRoom) {
		this.onNightAuditRollOverMarkVacantRoomString = String.format("%d", onNightAuditRollOverMarkVacantRoom.getId());
		this.onNightAuditRollOverMarkVacantRoom = onNightAuditRollOverMarkVacantRoom;
	}
	public CleaningStatus getMarkCheckedOutRoom() {
		if (markCheckedOutRoom == null && !(markCheckedOutRoomString == null || markCheckedOutRoomString.isEmpty())) {
			CleaningStatus c = new CleaningStatus(Long.parseLong(markCheckedOutRoomString));
			c.LoadData();
			markCheckedOutRoom = c;
		}
		return markCheckedOutRoom;
	}
	public void setMarkCheckedOutRoom(CleaningStatus markCheckedOutRoom) {
		this.markCheckedOutRoomString = String.format("%d", markCheckedOutRoom.getId());
		this.markCheckedOutRoom = markCheckedOutRoom;
	}
	public void setDefaultLanguageString(String defaultLanguageString) {
		this.defaultLanguageString = defaultLanguageString;
	}
	public void setDefaultCurrencyString(String defaultCurrencyString) {
		this.defaultCurrencyString = defaultCurrencyString;
	}
	public void setDateFormatString(String dateFormatString) {
		this.dateFormatString = dateFormatString;
	}
	public void setOnNightAuditRollOverMarkOccupiedString(
			String onNightAuditRollOverMarkOccupiedString) {
		this.onNightAuditRollOverMarkOccupiedString = onNightAuditRollOverMarkOccupiedString;
	}
	public void setOnNightAuditRollOverMarkVacantRoomString(
			String onNightAuditRollOverMarkVacantRoomString) {
		this.onNightAuditRollOverMarkVacantRoomString = onNightAuditRollOverMarkVacantRoomString;
	}
	public void setMarkCheckedOutRoomString(String markCheckedOutRoomString) {
		this.markCheckedOutRoomString = markCheckedOutRoomString;
	}
	
	public boolean isTimeFormatShow24Hours() {
		return timeFormatShow24Hours;
	}

	public void setTimeFormatShow24Hours(boolean timeFormatShow24Hours) {
		this.timeFormatShow24Hours = timeFormatShow24Hours;
	}

	public boolean isIncloudetax() {
		return incloudetax;
	}

	public void setIncloudetax(boolean incloudetax) {
		this.incloudetax = incloudetax;
	}
	
	public double getGMT() {
		return GMT;
	}

	public void setGMT(double gMT) {
		GMT = gMT;
	}

	public String getTimeZone() {
		return timeZone;
	}

	public void setTimeZone(String timeZone) {
		this.timeZone = timeZone;
	}

	public String getDefaultLanguageString() {
		return defaultLanguageString;
	}

	public String getDefaultCurrencyString() {
		return defaultCurrencyString;
	}

	public String getDateFormatString() {
		return dateFormatString;
	}

	public String getOnNightAuditRollOverMarkOccupiedString() {
		return onNightAuditRollOverMarkOccupiedString;
	}

	public String getOnNightAuditRollOverMarkVacantRoomString() {
		return onNightAuditRollOverMarkVacantRoomString;
	}

	public String getMarkCheckedOutRoomString() {
		return markCheckedOutRoomString;
	}
	

	public String getUsingCurrencyString() {
		return usingCurrencyString;
	}

	public void setUsingCurrencyString(String usingCurrencyString) {
		this.usingCurrencyString = usingCurrencyString;
	}

	
	
	public boolean isCurrencyconvert() {
		return currencyconvert;
	}

	public void setCurrencyconvert(boolean currencyconvert) {
		this.currencyconvert = currencyconvert;
	}

	public long getAssumechild() {
		return assumechild;
	}

	public void setAssumechild(long assumechild) {
		this.assumechild = assumechild;
	}

	public double getAgentcommission() {
		return agentcommission;
	}

	public void setAgentcommission(double agentcommission) {
		this.agentcommission = agentcommission;
	}

	public double getCoporatediscount() {
		return coporatediscount;
	}

	public void setCoporatediscount(double coporatediscount) {
		this.coporatediscount = coporatediscount;
	}

	public double getFeeforcancel() {
		return feeforcancel;
	}

	public void setFeeforcancel(double feeforcancel) {
		this.feeforcancel = feeforcancel;
	}

	public String getEnsuretype() {
		return ensuretype;
	}

	public void setEnsuretype(String ensuretype) {
		this.ensuretype = ensuretype;
	}

	public String getEnsureamount() {
		return ensureamount;
	}

	public void setEnsureamount(String ensureamount) {
		this.ensureamount = ensureamount;
	}

	public boolean isIspercentofbooking() {
		return ispercentofbooking;
	}

	public void setIspercentofbooking(boolean ispercentofbooking) {
		this.ispercentofbooking = ispercentofbooking;
	}

	public boolean isIsasperbookingpolicy() {
		return isasperbookingpolicy;
	}

	public void setIsasperbookingpolicy(boolean isasperbookingpolicy) {
		this.isasperbookingpolicy = isasperbookingpolicy;
	}

	public long getEarlycheckintimeamount() {
		return earlycheckintimeamount;
	}

	public void setEarlycheckintimeamount(long earlycheckintimeamount) {
		this.earlycheckintimeamount = earlycheckintimeamount;
	}

	public long getEarlycheckouttimeamount() {
		return earlycheckouttimeamount;
	}

	public void setEarlycheckouttimeamount(long earlycheckouttimeamount) {
		this.earlycheckouttimeamount = earlycheckouttimeamount;
	}

	public long getLatecheckouttimeamount() {
		return latecheckouttimeamount;
	}

	public void setLatecheckouttimeamount(long latecheckouttimeamount) {
		this.latecheckouttimeamount = latecheckouttimeamount;
	}

	public boolean isEarlycheckintimeunit() {
		return earlycheckintimeunit;
	}

	public void setEarlycheckintimeunit(boolean earlycheckintimeunit) {
		this.earlycheckintimeunit = earlycheckintimeunit;
	}

	public boolean isEarlycheckouttimeunit() {
		return earlycheckouttimeunit;
	}

	public void setEarlycheckouttimeunit(boolean earlycheckouttimeunit) {
		this.earlycheckouttimeunit = earlycheckouttimeunit;
	}

	public boolean isLatecheckouttimeunit() {
		return latecheckouttimeunit;
	}

	public void setLatecheckouttimeunit(boolean latecheckouttimeunit) {
		this.latecheckouttimeunit = latecheckouttimeunit;
	}

	public double getEarlycheckinchargeamount() {
		return earlycheckinchargeamount;
	}

	public void setEarlycheckinchargeamount(double earlycheckinchargeamount) {
		this.earlycheckinchargeamount = earlycheckinchargeamount;
	}

	public double getEarlycheckoutchargeamount() {
		return earlycheckoutchargeamount;
	}

	public void setEarlycheckoutchargeamount(double earlycheckoutchargeamount) {
		this.earlycheckoutchargeamount = earlycheckoutchargeamount;
	}

	public double getLatecheckoutchargeamount() {
		return latecheckoutchargeamount;
	}

	public void setLatecheckoutchargeamount(double latecheckoutchargeamount) {
		this.latecheckoutchargeamount = latecheckoutchargeamount;
	}

	public long getEarlycheckinchargeunit() {
		return earlycheckinchargeunit;
	}

	public void setEarlycheckinchargeunit(long earlycheckinchargeunit) {
		this.earlycheckinchargeunit = earlycheckinchargeunit;
	}

	public long getEarlycheckoutchargeunit() {
		return earlycheckoutchargeunit;
	}

	public void setEarlycheckoutchargeunit(long earlycheckoutchargeunit) {
		this.earlycheckoutchargeunit = earlycheckoutchargeunit;
	}

	public long getLatecheckoutchargeunit() {
		return latecheckoutchargeunit;
	}

	public void setLatecheckoutchargeunit(long latecheckoutchargeunit) {
		this.latecheckoutchargeunit = latecheckoutchargeunit;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	public double getNoshow_charge() {
		return noshow_charge;
	}

	public void setNoshow_charge(double noshow_charge) {
		this.noshow_charge = noshow_charge;
	}

	public boolean isNoshow_timeunit() {
		return noshow_timeunit;
	}

	public void setNoshow_timeunit(boolean noshow_timeunit) {
		this.noshow_timeunit = noshow_timeunit;
	}

	public boolean isNoshow_isExpectedArrival() {
		return noshow_isExpectedArrival;
	}

	public void setNoshow_isExpectedArrival(boolean noshow_isExpectedArrival) {
		this.noshow_isExpectedArrival = noshow_isExpectedArrival;
	}

	public long getMinuteForWarning() {
		return minuteForWarning;
	}

	public void setMinuteForWarning(long minuteForWarning) {
		this.minuteForWarning = minuteForWarning;
	}

	public long getMinuteForCritical() {
		return minuteForCritical;
	}

	public void setMinuteForCritical(long minuteForCritical) {
		this.minuteForCritical = minuteForCritical;
	}

	public Date getLastNightAudit() {
		return lastNightAudit;
	}

	public void setLastNightAudit(Date lastNightAudit) {
		this.lastNightAudit = lastNightAudit;
	}

	public boolean isInprogress() {
		return inprogress;
	}

	public void setInprogress(boolean inprogress) {
		this.inprogress = inprogress;
	}

	@Override
	public Entity getEntity() {
		Entity item;
		if(this.key == null)
			item = new Entity(EntityName.General);
		else
			item = new Entity(this.key);

		item.setProperty("hotelId", this.hotelId);
		item.setProperty("usingLanguage", this.usingLanguageString);
		item.setProperty("defaultLanguage", this.defaultLanguageString);
		item.setProperty("usingCurrency", this.usingCurrencyString);
		item.setProperty("defaultCurrency", this.defaultCurrencyString);
		item.setProperty("financialYearFrom", this.financialYearFrom);
		item.setProperty("financialYearTo", this.financialYearTo);
		item.setProperty("currencyConversionMargin", this.currencyConversionMargin);
		item.setProperty("currencyDecimalPlaces", this.currencyDecimalPlaces);
		item.setProperty("invoicesExclusiveTax", this.invoicesExclusiveTax);
		item.setProperty("taxBreakUp", this.taxBreakUp);
		item.setProperty("accountFolioOpeningDate", this.accountFolioOpeningDate);
		item.setProperty("dateFormat", this.dateFormatString);
		item.setProperty("timeFormatShow24Hours", this.timeFormatShow24Hours);
		item.setProperty("checkInTime", this.checkInTime);
		item.setProperty("checkOutTime", this.checkOutTime);
		item.setProperty("nightAuditTime", this.nightAuditTime);
		item.setProperty("auditUseCalendarDate", this.auditUseCalendarDate);
		item.setProperty("onNightAuditRollOverMarkOccupied", this.onNightAuditRollOverMarkOccupiedString);
		item.setProperty("onNightAuditRollOverMarkVacantRoom", this.onNightAuditRollOverMarkVacantRoomString);
		item.setProperty("markCheckedOutRoom", this.markCheckedOutRoomString);
		item.setProperty("includetax", this.incloudetax);
		item.setProperty("GMT", this.GMT);
		item.setProperty("timeZone", this.timeZone);
		
		item.setProperty("currencyconvert", this.currencyconvert);
		item.setProperty("assumechild", this.assumechild);
		item.setProperty("agentcommission", this.agentcommission);
		item.setProperty("coporatediscount", this.coporatediscount);
		item.setProperty("feeforcancel", this.feeforcancel);
		item.setProperty("ensuretype", this.ensuretype);
		item.setProperty("ensureamount", this.ensureamount);
		item.setProperty("ispercentofbooking", this.ispercentofbooking);
		item.setProperty("isasperbookingpolicy", this.isasperbookingpolicy);
		item.setProperty("earlycheckintimeamount", this.earlycheckintimeamount);
		item.setProperty("earlycheckouttimeamount", this.earlycheckouttimeamount);
		item.setProperty("latecheckouttimeamount", this.latecheckouttimeamount);
		item.setProperty("earlycheckintimeunit", this.earlycheckintimeunit);
		item.setProperty("earlycheckouttimeunit", this.earlycheckouttimeunit);
		item.setProperty("latecheckouttimeunit", this.latecheckouttimeunit);
		item.setProperty("earlycheckinchargeamount", this.earlycheckinchargeamount);
		item.setProperty("earlycheckoutchargeamount", this.earlycheckoutchargeamount);
		item.setProperty("latecheckoutchargeamount", this.latecheckoutchargeamount);
		item.setProperty("earlycheckinchargeunit", this.earlycheckinchargeunit);
		item.setProperty("earlycheckoutchargeunit", this.earlycheckoutchargeunit);
		item.setProperty("latecheckoutchargeunit", this.latecheckoutchargeunit);
		item.setProperty("noshow_charge", this.noshow_charge);
		item.setProperty("noshow_timeunit", this.noshow_timeunit);
		item.setProperty("noshow_isExpectedArrival", this.noshow_isExpectedArrival);
		item.setProperty("minuteForWarning", this.minuteForWarning);
		item.setProperty("minuteForCritical", this.minuteForCritical);
		item.setProperty("lastNightAudit", this.lastNightAudit);
		item.setProperty("inprogress", this.inprogress);
		return item;
	}
	@Override
	public void setEntity(Entity entity) {
		this.id = entity.getKey().getId();
		this.hotelId = (Long) entity.getProperty("hotelId");
		this.defaultLanguageString = (String) entity.getProperty("defaultLanguage");
		this.usingLanguageString = (String) entity.getProperty("usingLanguage");
		this.usingCurrencyString = (String) entity.getProperty("usingCurrency");
		this.defaultCurrencyString = (String) entity.getProperty("defaultCurrency");
		this.financialYearFrom = (Date) entity.getProperty("financialYearFrom");
		this.financialYearTo = (Date) entity.getProperty("financialYearTo");
		this.currencyConversionMargin = (Double) entity.getProperty("currencyConversionMargin");
		this.currencyDecimalPlaces = ((Long)entity.getProperty("currencyDecimalPlaces")).shortValue();
		this.invoicesExclusiveTax = (Boolean) entity.getProperty("invoicesExclusiveTax");
		this.taxBreakUp = (Boolean) entity.getProperty("taxBreakUp");
		this.accountFolioOpeningDate = (Boolean) entity.getProperty("accountFolioOpeningDate");
		this.dateFormatString = (String) entity.getProperty("dateFormat");
		this.timeFormatShow24Hours = (Boolean) entity.getProperty("timeFormatShow24Hours");
		this.checkInTime = (Date) entity.getProperty("checkInTime");
		this.checkOutTime = (Date) entity.getProperty("checkOutTime");
		this.nightAuditTime = (Date) entity.getProperty("nightAuditTime");
		this.auditUseCalendarDate = (Boolean) entity.getProperty("auditUseCalendarDate");
		this.onNightAuditRollOverMarkOccupiedString = (String) entity.getProperty("onNightAuditRollOverMarkOccupied");
		this.onNightAuditRollOverMarkVacantRoomString = (String) entity.getProperty("onNightAuditRollOverMarkVacantRoom");
		this.markCheckedOutRoomString = (String) entity.getProperty("markCheckedOutRoom");
		if(entity.getProperty("GMT") == null){
			this.GMT = 7;
		}else{
			this.GMT =(Double) entity.getProperty("GMT");
		}
		this.timeZone=(String) entity.getProperty("timeZone");
		if(entity.getProperty("includetax") == null){
			this.incloudetax = false;
		}else{
		this.incloudetax = (Boolean) entity.getProperty("includetax");
		}
		
		if(entity.getProperty("currencyconvert") == null){
			this.currencyconvert = false;
		}else{
			this.currencyconvert = (Boolean) entity.getProperty("currencyconvert");
		}
		if(entity.getProperty("assumechild") == null){
			this.assumechild = 0;
		}else{
			this.assumechild = (Long) entity.getProperty("assumechild");
		}
		if(entity.getProperty("agentcommission") == null){
			this.agentcommission = 0;
		}else{
			this.agentcommission = (Double) entity.getProperty("agentcommission");
		}
		if(entity.getProperty("coporatediscount") == null){
			this.coporatediscount = 0;
		}else{
			this.coporatediscount = (Double) entity.getProperty("coporatediscount");
		}		
		if(entity.getProperty("feeforcancel") == null){
			this.feeforcancel = 0;
		}else{
			this.feeforcancel = (Double) entity.getProperty("feeforcancel");
		}
		
		this.ensuretype = (String) entity.getProperty("ensuretype");
		this.ensureamount = (String) entity.getProperty("ensureamount");
		
		if( entity.getProperty("ispercentofbooking") == null){
			this.ispercentofbooking = false;
		}else{
			this.ispercentofbooking = (Boolean) entity.getProperty("ispercentofbooking");
		}
		
		if(entity.getProperty("isasperbookingpolicy") == null){
			this.isasperbookingpolicy = false;
		}else{
			this.isasperbookingpolicy = (Boolean) entity.getProperty("isasperbookingpolicy");
		}
		
		if(entity.getProperty("earlycheckintimeamount") == null){
			this.earlycheckintimeamount = 0;
		}else{
			this.earlycheckintimeamount = (Long) entity.getProperty("earlycheckintimeamount");
		}
		if(entity.getProperty("earlycheckouttimeamount") == null){
			this.earlycheckouttimeamount = 0;
		}else{
			this.earlycheckouttimeamount = (Long) entity.getProperty("earlycheckouttimeamount");
		}
		if(entity.getProperty("latecheckouttimeamount") == null){
			this.latecheckouttimeamount = 0;
		}else{
			this.latecheckouttimeamount = (Long) entity.getProperty("latecheckouttimeamount");
		}
		if(entity.getProperty("earlycheckintimeunit") == null){
			this.earlycheckintimeunit = false;
		}else{
			this.earlycheckintimeunit = (Boolean) entity.getProperty("earlycheckintimeunit");
		}
		if(entity.getProperty("earlycheckouttimeunit") == null){
			this.earlycheckouttimeunit = false;
		}else{
			this.earlycheckouttimeunit = (Boolean) entity.getProperty("earlycheckouttimeunit");
		}
		if(entity.getProperty("latecheckouttimeunit") == null){
			this.latecheckouttimeunit = false;
		}else{
			this.latecheckouttimeunit = (Boolean) entity.getProperty("latecheckouttimeunit");
		}
		if(entity.getProperty("earlycheckinchargeamount") == null){
			this.earlycheckinchargeamount = 0;
		}else{
			this.earlycheckinchargeamount = (Double) entity.getProperty("earlycheckinchargeamount");
		}
		if(entity.getProperty("earlycheckoutchargeamount") == null){
			this.earlycheckoutchargeamount = 0;
		}else{
			this.earlycheckoutchargeamount = (Double) entity.getProperty("earlycheckoutchargeamount");
		}
		if(entity.getProperty("latecheckoutchargeamount") == null){
			this.latecheckoutchargeamount = 0;
		}else{
			this.latecheckoutchargeamount = (Double) entity.getProperty("latecheckoutchargeamount");
		}
		if(entity.getProperty("earlycheckinchargeunit") == null){
			this.earlycheckinchargeunit = 0;
		}else{
			this.earlycheckinchargeunit = (Long) entity.getProperty("earlycheckinchargeunit");
		}
		if(entity.getProperty("earlycheckoutchargeunit") == null){
			this.earlycheckoutchargeunit = 0;
		}else{
			this.earlycheckoutchargeunit = (Long) entity.getProperty("earlycheckoutchargeunit");
		}
		if(entity.getProperty("latecheckoutchargeunit") == null){
			this.latecheckoutchargeunit = 0;
		}else{
			this.latecheckoutchargeunit = (Long) entity.getProperty("latecheckoutchargeunit");
		}
		if(entity.getProperty("noshow_charge") == null){
			this.noshow_charge = 0;
		}else{
			this.noshow_charge = (Double) entity.getProperty("noshow_charge");
		}
		if(entity.getProperty("noshow_timeunit") == null){
			this.noshow_timeunit = true;
		}else{
			this.noshow_timeunit = (Boolean) entity.getProperty("noshow_timeunit");
		}
		if(entity.getProperty("noshow_isExpectedArrival") == null){
			this.noshow_isExpectedArrival = true;
		}else{
			this.noshow_isExpectedArrival = (Boolean) entity.getProperty("noshow_isExpectedArrival");
		}
		if(entity.getProperty("minuteForWarning") == null){
			this.minuteForWarning = 40;
		}else{
			this.minuteForWarning = (Long) entity.getProperty("minuteForWarning");
		}
		if(entity.getProperty("minuteForCritical") == null){
			this.minuteForCritical = 20;
		}else{
			this.minuteForCritical = (Long) entity.getProperty("minuteForCritical");
		}
		if(entity.getProperty("lastNightAudit") == null){
			this.lastNightAudit = Util.GetOnlyDate(new Date());
		}else{
			this.lastNightAudit = (Date) entity.getProperty("lastNightAudit");
		}
		if(entity.getProperty("inprogress") == null){
			this.inprogress = false;
		}else{
			this.inprogress = (Boolean) entity.getProperty("inprogress");
		}
		
		
		this.key = entity.getKey();
	}

	public void LoadData() {
		if (this.id > -1) {
			Entity entity = LoadData(EntityName.General, this.id);
			setEntity(entity);
		}
	}
}
